# Maintainer: zxp19821005 <zxp19821005 at 163 dot com>
_pkgname=navicat
pkgname="${_pkgname}-premium-lite-cs-appimage"
pkgver=17.0.7
pkgrel=1
pkgdesc="Navicat Premium Lite 是 Navicat 的精简版."
arch=(
    'aarch64'
    'x86_64'
)
url="https://www.navicat.com.cn/products/navicat-premium-lite"
license=('proprietary')
provides=("${pkgname%-appimage}=${pkgver}")
conflicts=("${pkgname%-appimage}")
depends=()
makedepends=(
    'fuse2'
)
options=('!strip')
_install_path="/opt/appimages"
source_aarch64=("${pkgname%-appimage}-${pkgver}-aarch64.AppImage::https://dn.navicat.com/download/navicat17-premium-lite-cs-aarch64.AppImage")
source_x86_64=("${pkgname%-appimage}-${pkgver}-x86_64.AppImage::https://dn.navicat.com/download/navicat17-premium-lite-cs-x86_64.AppImage")
sha256sums_aarch64=('b547d8b143f3af4a406780378726c6e018283de8598be06d494525bc2ae5d4dd')
sha256sums_x86_64=('3c31ae2af3d2330882424b8a09036f90a154862e1b11a9208c657d8f30a8df05')
build() {
    chmod a+x "${srcdir}/${pkgname%-appimage}-${pkgver}-${CARCH}.AppImage"
    "${srcdir}/${pkgname%-appimage}-${pkgver}-${CARCH}.AppImage" --appimage-extract > /dev/null
    sed "s|Exec=${_pkgname}|Exec=${pkgname%-appimage}|g;s|Icon=${_pkgname}-icon|Icon=${pkgname%-appimage}|g" \
        -i "${srcdir}/squashfs-root/${_pkgname}.desktop"
}
package() {
    install -Dm755 "${srcdir}/${pkgname%-appimage}-${pkgver}-${CARCH}.AppImage" "${pkgdir}/${_install_path}/${pkgname%-appimage}.AppImage"
    install -Dm755 -d "${pkgdir}/usr/bin"
    ln -sf "${_install_path}/${pkgname%-appimage}.AppImage" "${pkgdir}/usr/bin/${pkgname%-appimage}"
    install -Dm644 "${srcdir}/squashfs-root/${_pkgname}-icon.png" "${pkgdir}/usr/share/pixmaps/${pkgname%-appimage}.png"
    install -Dm644 "${srcdir}/squashfs-root/${_pkgname}.desktop" "${pkgdir}/usr/share/applications/${pkgname%-appimage}.desktop"
}